<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.staticfile.org/jquery/3.6.3/jquery.js"></script>

</head>

<body>
    <button id="get">get</button>
    <button id="post">post</button>

    <script>

        $(function () {
            $('#get').on('click', function () {
                $.ajax({
                    type: 'get',
                    url: 'http://127.0.0.1/api/get',
                    data: { name: 'zs', age: 18 },
                    success: function (res) {
                        console.log(res);
                    }
                })
            })

            $('#post').on('click', function () {
                $.ajax({
                    type: 'post',
                    url: 'http://127.0.0.1/api/post',
                    data: { superName: '一拳超人', age: 30 },
                    success: function (res) {
                        console.log(res);
                    }
                })
            })
        })
    </script>
</body>

</html>